home *** CD-ROM | disk | FTP | other *** search
- ' Windows Script Host Sample Script
- '
- ' ------------------------------------------------------------------------
- ' Copyright (C) 1996 Microsoft Corporation
- '
- ' You have a royalty-free right to use, modify, reproduce and distribute
- ' the Sample Application Files (and/or any modified version) in any way
- ' you find useful, provided that you agree that Microsoft has no warranty,
- ' obligations or liability for any Sample Application Files.
- ' ------------------------------------------------------------------------
- '
- ' VBS Script to set password
- '
- ' Syntax: setpass.vbs /C=<country>/O=<o>/OU=<ou> accountname password
- '
- ' Example setpass.vbs /C=US/O=ArcadiaBay/OU=Americas PaulCezanne secret
- '
- dim con
- dim oArgs
- dim newuser
-
- dim Style
- dim Title
- dim CRLF
-
- CRLF = Chr(13) & Chr(10)
-
- set oArgs = WScript.Arguments
-
- If oArgs.Count < 2 Then
- Style = vbOKOnly ' Define buttons.
- Title = "Usage" ' Define title.
-
- Response = MsgBox("Set password via OLE DS" & CRLF & CRLF & _
- "Usage:" & CRLF & CRLF & _
- " setpass.vbs /C=<country>/O=<o>/OU=<ou> accountname password " & CRLF & CRLF & _
- "Example:" & CRLF & CRLF & _
- " setpass.vbs /C=US/O=ArcadiaBay/OU=Americas PaulCezanne secret" & CRLF, _
- Style, Title)
-
- 'stop script
- WScript.Quit(1)
- End If
-
- set u = wscript.GetObject("LDAP:/"+oArgs.item(0)+"/CN="+oArgs.item(1))
- u.setpassword(oArgs.item(2))
- wscript.echo "Password for "+u.name+" reset."
- set u=nothing
- '
- ' Finis
- '
-
-